#include "StompedReality/Core/Game.h"
#include <UnitTest++.h>
#ifdef LINUX
#include "StompedReality/Core/Graphics/LinuxRenderSystem.h"
#elif WIN32
#include "StompedReality/Core/Graphics/Windows/WGLRenderSystem.h"
#endif
#include "StompedReality/Components/BaseComponents.h"
#include "StompedReality/Core/Memory/ObjectPoolManager.h"
#include "StompedReality/Core/TypeSystem/TypeSystem.h"

SUITE ( Game_Systems_Test )
{
  static const StompedReality::ID NEW_OBJECT_ID_ADD = 0x10000;
  using namespace StompedReality;
  using namespace StompedReality::components;
  TEST ( Component_System_Test )
  {
    Game game;

#ifdef LINUX
    game.setRenderer( new StompedReality::Graphics::LinuxRenderSystem( ));
#elif WIN32
    game.setRenderer( new StompedReality::Graphics::WGLRenderSystem( ));
#endif
    game.ParseConfig( "Content-StompedRealityUnitTest/gs_test.json" );
    StompedReality::type_system::TypeInfo* info  =
      StompedReality::type_system::TypeSystem::GetType<RenderInfoComponent>( );
    game.getComponentSystem( )->CreateBlock (
      StompedReality::type_system::TypeSystem::GetType<RenderInfoComponent>( ), 2 );
    ID cmpA = game.getComponentSystem( )->CreateObject ( info->typeID );
    CHECK_EQUAL ( NEW_OBJECT_ID_ADD + 0, cmpA );
    ID cmpB = game.getComponentSystem( )->CreateObject ( info->typeID );
    CHECK_EQUAL ( NEW_OBJECT_ID_ADD + 1, cmpB );
  }
}
